import { defineStore } from "pinia";
import { PermissionState } from "@/stores/interface";
import { getPermissionListApi } from "@/api/modules/permission";

export const userPermissionStore = defineStore({
  id: "geeker-permission",
  state: (): PermissionState => ({
    permissions: []
  }),
  getters: {
    // 按钮权限列表
    permissionsGet: state => state.permissions
  },
  actions: {
    async getPermissions() {
      const { data } = await getPermissionListApi();
      this.permissions = data;
    }
  }
});
